package com.trsj.lnsj;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableSwagger2
//@EnableScheduling
public class Application extends SpringBootServletInitializer
    implements ApplicationListener<ContextRefreshedEvent> {

  private static Logger logger = LoggerFactory.getLogger(Application.class);

  /**
   * Start
   */
  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
    logger.info("SpringBoot Start Success");
  }

  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
  }

  @Override
  public void onApplicationEvent(ContextRefreshedEvent event) {
    logger.info("Application init completed");
  }

//  @Bean
//  public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
//      final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
//      JacksonObjectMapper mapper = new JacksonObjectMapper();
//      converter.setObjectMapper(mapper);
//      return converter;
//  }

}
